/*<![CDATA[*/

/**
 * IC卡信息管理
 */
function manageICCardInfo() {
	var url = encodeURI("/IMS/icCard/manageICCardInfo.ht?communityName="
			+ communityName + "&cid=" + cid);
	if(cid==null||cid=='null'){
		url = encodeURI("/IMS/icCard/manageICCardInfo.ht");
	}
	locationHref(url);
}

/*******************************************************************************
 * 解除绑定
 ******************************************************************************/
function unboundICCard(cardNo) {
	_confirm('<span style="color:#FE6600">是否解绑当前记录</span>', function() {
		if (userType != '3') {
			_alert("非小区管理员,无权解绑");
			return;
		}
		var search = $("#search").val();
		var _url = "/IMS/icCard/unboundICCard.ht";
		var _data = {
			"cardNo" : cardNo
		};
		$.ajax({
			url : _url,
			async : false,
			type : "post",
			data : _data,
			dataType : "json",
			success : function(value) {
				var code = value.code;
				if (code == message_success_code) {
					_alert(value.message);
					var listUrl = "/IMS/icCard/showList.ht?cid=" + cid
							+ "&communityName=" + communityName + "&search="
							+ search;
					locationHref(listUrl);
				} else {
					_alert(value.msg);
					return;
				}
			},
			error : function(value, a, b) {
				_alert(value.status);
				return;
			}
		});
	});
}

/*******************************************************************************
 * 绑定IC卡
 ******************************************************************************/
function bindingICCardInfo() {
	var search = $("#search").val();
	var url = "/IMS/icCard/getBindingPage.ht?cid=" + cid + "&communityName="
			+ communityName + "&search=" + search;
	locationHref(url);
}

$(document).ready(function() {
	initCommunityWidget("cid","/IMS/select/getCommunityList.ht",true);
});

function searchSubmit(){
	var communityId = $("#select2-cid-container").text();
	if(communityId=='请选择小区'){
		_alert("请选择小区");
	}else{
		if(userType!=3){
			$('#frm').submit();
		}else{
			var search = $("#search").val();
			if(Is_Null(search)){
				_alert("请输入查询条件后再搜索");
				return;
			}
			$('#frm').submit();
		}
	}
}
/* ]]> */